#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 1e5+5;
const int M = 1e9 + 7;

int t, n, a[N];

// multiset
int m[2][N];

int main()
{
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0);

    cin >> t;
    while (t--)
    {
        cin >> n;
        memset(m, 0, sizeof(m));
        for (int i = 1; i <= n; i++)
        {
            cin >> a[i];
            m[i&1][a[i]]++;
        }

        sort(a + 1, a + n + 1);

        bool flag = true;
        for (int i = 1; i <= n; i++) {
            int &p = m[i&1][a[i]];

            if (--p < 0) {
                flag = false;
                break;
            }
        }

        puts(flag ? "YES" : "NO");
    }
    return 0;
}